﻿using ClassMySQL;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using TeacherLoad.Properties;
using TeacherLoad.Windows;

namespace TeacherLoad
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        private static string _host = Settings.Default.host;
        private static string _db = Settings.Default.database;
        private static string _login = Settings.Default.login;
        private static string _password = Settings.Default.password;
        public MainWindow()
        {
            InitializeComponent();
            StartApp();
        }

        private void StartApp()
        {
            ServerMySQL.DB_Load(_host, _db, _login, _password);
            if (!ServerMySQL.CheckConnect())
            {
                MessageBox.Show("Ошибка соединения");
            }
        }

        private void menuSpec_Click(object sender, RoutedEventArgs e)
        {
            Window window = new SpecList();
            window.ShowDialog();
        }

        private void menuSettings_Click(object sender, RoutedEventArgs e)
        {
            Window window = new SettingsApp();
            window.ShowDialog();
        }

        private void menuGroup_Click(object sender, RoutedEventArgs e)
        {
            Window window = new GroupList();
            window.ShowDialog();
        }

        private void menuAcadItems_Click(object sender, RoutedEventArgs e)
        {
            Window window = new AcadItems();
            window.ShowDialog();
        }

        private void menuTeacher_Click(object sender, RoutedEventArgs e)
        {
            Window window = new TeacherList();
            window.ShowDialog();
        }

        private void menuUchebPlan_Click(object sender, RoutedEventArgs e)
        {
            Window window = new UchebPlanList();
            window.ShowDialog();
        }
    }
}